/*
@author :王少明 
@Createdate:2006-12-14
@des : xmlHttp请求类
*/
function NetLoad(smothod,surl,sasync,scontent,scallback) {
	this.xmlObj = this.CreateObjHttp();

	this.method=smothod?smothod:"POST";
	this.url = surl?surl:null;
	this.async=sasync?sasync:true;
	this.content=scontent?scontent:"";
	this.contentXMLDom=null ;	
	this.callback=scallback?scallback:function(cbobj) {return;}
}
NetLoad.prototype.send = function()
{  
    var netload = this ;    
	if(!netload.method||!netload.url||!netload.async) return false;
		netload.xmlObj.open (netload.method, netload.url, netload.async);
		if(netload.method=="POST") netload.xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		netload.xmlObj.onreadystatechange=function() {			
			if(netload.xmlObj.readyState==4) {				
				if(netload.xmlObj.status==200) {								   
					netload.callback(netload.xmlObj);//?
				}
			}
		}
		if(netload.method=="POST")
		{	 
			 if(netload.contentXMLDom==null)
			 netload.contentXMLDom = netload.GetXmlDom();
			 
			 netload.contentXMLDom.loadXML(netload.content);
			 netload.xmlObj.send(netload.contentXMLDom);
		}
		else {netload.xmlObj.send(null);}
}
NetLoad.prototype.GetXmlDom = function()
{
	  var obj = null;
      if (typeof(DOMParser) != "undefined") { // Gecko、Mozilla、Firefox
        var parser = new DOMParser();
        obj = parser.parseFromString(xmlText, "text/xml");
      } else { // IE
        try { obj = new ActiveXObject("MSXML2.DOMDocument");} catch (e) { }
        if (obj == null) try { obj = new ActiveXObject("Microsoft.XMLDOM"); } catch (e) { }
      }
      return obj;
}
NetLoad.prototype.CreateObjHttp = function()
{
	var xhttp = null;
    if(window.XMLHttpRequest)
    { //IE7, Mozilla ,Firefox 等浏览器内置该对象
      xhttp = new XMLHttpRequest();      
    }
    else if(window.ActiveXObject)
    { //IE6、IE5
      try{ 
         xhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch (e){ ; }      
      if( xhttp == null)
      {
       try {
            xhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e){; }   
      }    
    }
    return xhttp;
}
